home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / em7sui_1 / em7sui~1.exe / frmGraphTest.fr_ / frmGraphTest.fr
Text File  |  1998-12-29  |  11KB  |  368 lines

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  4. Object = "{056FF13B-7EE8-11D2-9507-A44605C12BC0}#1.1#0"; "VRAssist.ocx"
  5. Object = "{23B2BD1E-7EF1-11D2-9507-A44605C12BC0}#1.1#0"; "VRAssist_GRAPH.ocx"
  6. Begin VB.Form Form1 
  7.    Caption         =   "VRAssist_GRAPH test"
  8.    ClientHeight    =   3675
  9.    ClientLeft      =   60
  10.    ClientTop       =   390
  11.    ClientWidth     =   7365
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3675
  14.    ScaleWidth      =   7365
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VRAssist_GRAPH.VRGraphCtl VRGraphCtl 
  17.       Left            =   6510
  18.       Top             =   840
  19.       _ExtentX        =   1085
  20.       _ExtentY        =   1085
  21.    End
  22.    Begin VRAssist.VRAssistCtl VRAssistCtl 
  23.       Left            =   6510
  24.       Top             =   120
  25.       _ExtentX        =   1085
  26.       _ExtentY        =   1085
  27.    End
  28.    Begin MSComDlg.CommonDialog dialog 
  29.       Left            =   6540
  30.       Top             =   1590
  31.       _ExtentX        =   847
  32.       _ExtentY        =   847
  33.       _Version        =   327680
  34.    End
  35.    Begin VB.PictureBox picColor 
  36.       BackColor       =   &H00DADADA&
  37.       DrawWidth       =   2
  38.       Height          =   375
  39.       Index           =   0
  40.       Left            =   4410
  41.       ScaleHeight     =   315
  42.       ScaleWidth      =   315
  43.       TabIndex        =   11
  44.       Top             =   285
  45.       Width           =   375
  46.    End
  47.    Begin VB.PictureBox picColor 
  48.       BackColor       =   &H00B3D67E&
  49.       DrawWidth       =   2
  50.       Height          =   375
  51.       Index           =   2
  52.       Left            =   4395
  53.       ScaleHeight     =   315
  54.       ScaleWidth      =   315
  55.       TabIndex        =   10
  56.       Top             =   3000
  57.       Width           =   375
  58.    End
  59.    Begin VB.PictureBox picColor 
  60.       BackColor       =   &H00F0CC9B&
  61.       DrawWidth       =   2
  62.       Height          =   375
  63.       Index           =   1
  64.       Left            =   4410
  65.       ScaleHeight     =   315
  66.       ScaleWidth      =   315
  67.       TabIndex        =   9
  68.       Top             =   1530
  69.       Width           =   375
  70.    End
  71.    Begin VB.TextBox txtValue 
  72.       Height          =   300
  73.       Index           =   1
  74.       Left            =   4380
  75.       TabIndex        =   4
  76.       Top             =   2610
  77.       Width           =   1830
  78.    End
  79.    Begin VB.TextBox txtValue 
  80.       Height          =   300
  81.       Index           =   0
  82.       Left            =   4395
  83.       TabIndex        =   2
  84.       Top             =   1170
  85.       Width           =   1830
  86.    End
  87.    Begin MSFlexGridLib.MSFlexGrid dataGrid 
  88.       Height          =   1050
  89.       Index           =   0
  90.       Left            =   90
  91.       TabIndex        =   1
  92.       Top             =   885
  93.       Width           =   3945
  94.       _ExtentX        =   6959
  95.       _ExtentY        =   1852
  96.       _Version        =   327680
  97.       Rows            =   4
  98.       Cols            =   4
  99.       FixedRows       =   0
  100.       FixedCols       =   0
  101.       AllowBigSelection=   0   'False
  102.    End
  103.    Begin VB.CommandButton Command1 
  104.       Caption         =   "Run test"
  105.       Height          =   315
  106.       Left            =   105
  107.       TabIndex        =   0
  108.       Top             =   195
  109.       Width           =   1305
  110.    End
  111.    Begin MSFlexGridLib.MSFlexGrid dataGrid 
  112.       Height          =   1035
  113.       Index           =   1
  114.       Left            =   90
  115.       TabIndex        =   3
  116.       Top             =   2355
  117.       Width           =   3945
  118.       _ExtentX        =   6959
  119.       _ExtentY        =   1826
  120.       _Version        =   327680
  121.       Rows            =   4
  122.       Cols            =   4
  123.       FixedRows       =   0
  124.       FixedCols       =   0
  125.       AllowBigSelection=   0   'False
  126.    End
  127.    Begin VB.Label Label1 
  128.       Caption         =   "Chart grid"
  129.       Height          =   255
  130.       Index           =   4
  131.       Left            =   4425
  132.       TabIndex        =   12
  133.       Top             =   45
  134.       Width           =   1050
  135.    End
  136.    Begin VB.Label Label1 
  137.       Caption         =   "Value"
  138.       Height          =   255
  139.       Index           =   3
  140.       Left            =   4380
  141.       TabIndex        =   8
  142.       Top             =   2370
  143.       Width           =   1050
  144.    End
  145.    Begin VB.Label Label1 
  146.       Caption         =   "Value"
  147.       Height          =   255
  148.       Index           =   2
  149.       Left            =   4395
  150.       TabIndex        =   7
  151.       Top             =   930
  152.       Width           =   1050
  153.    End
  154.    Begin VB.Label Label1 
  155.       Caption         =   "Data set B"
  156.       Height          =   255
  157.       Index           =   1
  158.       Left            =   180
  159.       TabIndex        =   6
  160.       Top             =   2145
  161.       Width           =   3405
  162.    End
  163.    Begin VB.Label Label1 
  164.       Caption         =   "Data set A"
  165.       Height          =   255
  166.       Index           =   0
  167.       Left            =   180
  168.       TabIndex        =   5
  169.       Top             =   675
  170.       Width           =   3405
  171.    End
  172. End
  173. Attribute VB_Name = "Form1"
  174. Attribute VB_GlobalNameSpace = False
  175. Attribute VB_Creatable = False
  176. Attribute VB_PredeclaredId = True
  177. Attribute VB_Exposed = False
  178. Option Explicit
  179. Option Base 1
  180.  
  181. Dim m_world As Group
  182. Dim m_mat(3) As Material
  183. Dim m_colA(4) As em7_RoundedColumnSeries
  184. Dim m_colB(4) As em7_RoundedColumnSeries
  185.  
  186. Private Sub Command1_Click()
  187.  
  188. Call GenerateFile
  189.  
  190. End Sub
  191.  
  192. Private Sub Form_Load()
  193.  
  194. Call PopulateGrids
  195. Call CreateChart
  196.  
  197. End Sub
  198.  
  199. Private Sub dataGrid_EnterCell(Index As Integer)
  200.  
  201. txtValue(Index).Text = dataGrid(Index).Text
  202.  
  203. End Sub
  204.  
  205. Private Sub picColor_Click(Index As Integer)
  206.  
  207. dialog.Flags = cdlCCRGBInit Or cdlCCFullOpen
  208. dialog.Color = picColor(Index).BackColor
  209. dialog.ShowColor
  210. picColor(Index).BackColor = dialog.Color
  211.  
  212. End Sub
  213.  
  214. Private Sub txtValue_Change(Index As Integer)
  215.  
  216. dataGrid(Index).Text = txtValue(Index).Text
  217.  
  218. End Sub
  219.  
  220. Private Sub txtValue_GotFocus(Index As Integer)
  221.  
  222. txtValue(Index).SelStart = 0
  223. txtValue(Index).SelLength = Len(txtValue(Index).Text)
  224.  
  225. End Sub
  226.  
  227. Private Sub PopulateGrids()
  228. Dim i, j As Integer
  229.  
  230. For i = 0 To 3
  231.     dataGrid(0).Row = i
  232.     dataGrid(1).Row = i
  233.     For j = 0 To 3
  234.         dataGrid(0).Col = j
  235.         dataGrid(1).Col = j
  236.         dataGrid(0).Text = 4 - i + j
  237.         dataGrid(1).Text = Format(Rnd * 8#, "0.00")
  238.     Next j
  239. Next i
  240.  
  241. End Sub
  242.  
  243. Private Sub CreateChart()
  244. Dim grid As em7_ChartGrid
  245. Dim objApp(3) As Appearance
  246. Dim transA(4) As Transform
  247. Dim transB(4) As Transform
  248. Dim protoRef As IExternProto
  249. Dim nodeRef As IVRMLNode
  250. Dim i As Integer
  251. Dim curGap As Single
  252. Dim objFactory As IVRMLFactory
  253.  
  254. Set objFactory = VRGraphCtl.Factory
  255.  
  256. ' create the root of the scene
  257. Set m_world = objFactory.CreateNode("Group")
  258.  
  259. ' make the materials
  260. For i = 1 To 3
  261.     Set objApp(i) = objFactory.CreateNode("Appearance")
  262.     Set m_mat(i) = objFactory.CreateNode("Material")
  263.     objApp(i).MaterialField.Value = m_mat(i)
  264. Next i
  265.  
  266. 'now create the chart grid
  267. Set grid = objFactory.CreateNode("em7_ChartGrid")
  268. Set protoRef = grid
  269. protoRef.SourceFile = "..\..\..\ProtoPac\VR_GRAPH.wrl"
  270. grid.AppearanceField.Value = objApp(1)
  271. grid.XDimensionField.Value = 5
  272. grid.XSpacingField.Value = 3
  273. grid.YDimensionField.Value = 5
  274. grid.YSpacingField.Value = 2
  275. grid.ZDimensionField.Value = 5
  276. grid.ZSpacingField.Value = 2
  277. ' add it to the scene
  278. Call m_world.ChildrenField.AddValue(grid)
  279.  
  280. 'create the two transform sets
  281. curGap = 0.65
  282. For i = 1 To 4
  283.     Set transA(i) = objFactory.CreateNode("Transform")
  284.     Set transB(i) = objFactory.CreateNode("Transform")
  285.     Call transA(i).TranslationField.SetValues(1.05, 0#, curGap)
  286.     Call transB(i).TranslationField.SetValues(1.95, 0#, curGap)
  287.     ' add it to the scene
  288.     Call m_world.ChildrenField.AddValue(transA(i))
  289.     Call m_world.ChildrenField.AddValue(transB(i))
  290.     curGap = curGap + 2#
  291. Next i
  292.  
  293. 'create the two column sets
  294. For i = 1 To 4
  295.     Set m_colA(i) = objFactory.CreateNode("